<template>
	<div class="app-container">
		<div class="head-container">
			<div v-if="crud.props.searchToggle">
				<el-input v-model="query.serviceTitle" clearable size="small" placeholder="根据服务标题进行搜索"
					style="width: 200px;" class="filter-item" @keyup.enter.native="crud.toQuery" />
				<rrOperation />
			</div>
			<crudOperation :permission="permission" />
		</div>

		<!-- 表单 -->
		<!-- <el-dialog
      append-to-body
      :close-on-click-modal="false"
      :before-close="crud.cancelCU"
      :visible.sync="crud.status.cu > 0"
      :title="crud.status.title"
      width="680px"
    >
      <el-form ref="form" :model="form" label-width="120px">
        <el-form-item label="公司名称">
          <el-input v-model="form.companyName" />
        </el-form-item>
        <el-form-item label="联系热线">
          <el-input v-model="form.phoneNumber" />
        </el-form-item>
        <el-form-item label="公司所在城市">
          <el-select v-model="form.companyCity" placeholder="请选择公司所在的城市">
            <el-option
              v-for="(item,index) in cityList"
              :key="index"
              :label="item.value"
              :value="item.value"
            />
          </el-select>
        </el-form-item>
        <el-form-item label="公司地址">
          <el-input v-model="form.address" />
        </el-form-item>
        <el-form-item label="工作时间">
          <el-input v-model="form.workingHours" />
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button type="text" @click="crud.cancelCU">取消</el-button>
        <el-button :loading="crud.status.cu === 2" type="primary" @click="crud.submitCU">确认</el-button>
      </div>
    </el-dialog> -->

		<!--表格渲染-->
		<el-table ref="table" v-loading="crud.loading" :data="crud.data" style="width: 100%;"
			@selection-change="crud.selectionChangeHandler">
			<el-table-column type="selection" width="55" />
			<el-table-column prop="serviceTitle" align="center" label="所属服务" />
			<el-table-column prop="userName" align="center" label="预定者姓名" width="200px" />
			<el-table-column prop="contactNumber" align="center" label="预定者电话" />
			<el-table-column prop="createTime" align="center" label="预定时间" width="300px" />
			<el-table-column v-if="checkPer(['admin','menu:del'])" align="center" label="操作" width="150px"
				fixed="right">
				<template slot-scope="scope">
					<udOperation :data="scope.row" :permission="permission" msg="确定删除吗，此操作不能撤销！" />
				</template>
			</el-table-column>
		</el-table>
		<!--分页组件-->
		<pagination />
	</div>
</template>

<script>
	import crudScheduledService from '@/api/finace_taxation/scheduled_service.js'
	import CRUD, {
		presenter,
		header,
		form,
		crud
	} from '@crud/crud'
	import rrOperation from '@crud/RR.operation'
	import crudOperation from '@crud/CRUD.operation'
	import pagination from '@crud/Pagination'
	import udOperation from '@crud/UD.operation'

	// crud交由presenter持有
	const defaultForm = {
		companyName: null,
		companyCity: null,
		workingHours: null,
		address: null,
		phoneNumber: null,
		permission: null
	}

	export default {
		name: 'LeaveMessage',
		components: {
			pagination,
			crudOperation,
			rrOperation,
			udOperation
		},
		cruds() {
			return CRUD({
				url: 'api/ft/ftLeaveMessage/getScheduledService',
				title: '服务预定管理',
				crudMethod: {
					...crudScheduledService
				}
			})
		},
		mixins: [presenter(), header(), form(defaultForm), crud()],
		data() {
			return {
				delLoading: false,
				permission: {
					add: ['admin', 'ftLeaveMessage:add'],
					edit: ['admin', 'ftLeaveMessage:edit'],
					del: ['admin', 'ftLeaveMessage:del']
				}
			}
		},
		created() {
			this.crud.optShow = {
				add: false,
				reset: true,
				download: true
			}
		},
		methods: {

		}
	}
</script>
